home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / 80x0992d.zip / CHILD.TXT < prev    next >
Text File  |  1992-09-30  |  1KB  |  35 lines

  1. By: Dave Walker
  2. --------------------------------------------------------------------
  3.  
  4. AW>Could ANYONE post me the structures, registers, etc. for
  5. AW>the DOS exec (4Bh) call? I just CAN'T make the blasted
  6. AW>thing work... grrr.. I've also heard there's a _REALLY_
  7. AW>undocumented call that will use COMMAND.COM to execute a
  8. AW>command. Any knowledge of this?
  9.  
  10. Here's a simple model for invoking a child process.  For simplicity, it
  11. uses the parent's PSP and environment.  This is written in TASM format
  12. using ideal mode, but it shouldn't be too hard to convert if desired.
  13. There are a couple of things that might need explanation:
  14.  
  15.   - On starting an EXE program, DS and ES point to the PSP.  In other
  16.     words, DS:0 = ES:0 = PSP:0.
  17.  
  18.   - The environment segment is stored at PSP:002Ch.  If you want the
  19.     child to inherit the parent's environment, just fetch [PSP:002Ch]
  20.     and store it in the first word of the parameter block.
  21.  
  22. To invoke a second copy of the command processor (not necessarily
  23. COMMAND.COM, ie. 4DOS, etc.) try replacing the childname with something
  24. similar to this:
  25.  
  26. dosfunc     db      '/C dir *.exe',0    ;Do DIR for EXE files
  27.  
  28. The /C option tells the command processor to execute the command and
  29. return to it's caller.  By not using the /C option, you can invoke a
  30. shell like so:
  31.  
  32. shell       db      'prompt SHELL$g',0  ;Invoke DOS shell
  33.  
  34. Dave 1:396/1
  35.